Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix]: enhance kubelet package impl #1894

Merged

Conversation

SamYuan1990
Copy link
Collaborator

@SamYuan1990 SamYuan1990 commented Dec 12, 2024

keep kubelet token in memory to reduce os.file read for each time to get auth token.
if token expired, try again.
refactor with var injection for test case impl.

Copy link
Contributor

github-actions bot commented Dec 12, 2024

🤖 SeineSailor

Here is a concise summary of the pull request changes:

Summary: This pull request optimizes token handling in the kubelet package by introducing changes to minimize os.File reads, retry token retrieval on expiration, and refactor test cases.

Key Modifications:

  1. In-memory storage of kubelet token to reduce file reads.
  2. Token retrieval retry on expiration.
  3. Removal of unused context variable.
  4. Refactored httpGet function with new path parameter.
  5. Updated ListPods function to call modified httpGet with saPath and podURL arguments.

Impact: These changes may affect the package's external interface and behavior. The introduction of a new global variable bearerToken and modified function signatures (e.g., httpGet) may require adjustments in dependent components.

Suggestions:

  • Consider adding unit tests to ensure the new token retrieval logic and retry mechanism work as expected.
  • Review the impact of the bearerToken global variable on the package's overall architecture and potential thread-safety concerns.
  • Document the changes to the httpGet function and its new behavior to ensure clear understanding for future maintainers.

@SamYuan1990 SamYuan1990 marked this pull request as ready for review December 12, 2024 06:02
@SamYuan1990 SamYuan1990 marked this pull request as draft December 12, 2024 06:14
@SamYuan1990 SamYuan1990 marked this pull request as ready for review December 12, 2024 06:23
@SamYuan1990 SamYuan1990 enabled auto-merge (squash) December 12, 2024 06:24
Copy link
Collaborator

@sunya-ch sunya-ch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you.

@SamYuan1990 SamYuan1990 merged commit 98275d0 into sustainable-computing-io:main Dec 19, 2024
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants